package components.weapon;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.appearances.Appearance;
import components.CollisionableComponent;
import components.asteroids.Asteroid;
import components.scenes.MainGameScene;

public class Proyectile extends CollisionableComponent<MainGameScene> {

	private double speed;
	private double dirVecX;
	private double dirVecY;
	
	private int power;
	
	public void setPower(int power) {
		this.power = power;
	}


	public Proyectile(int shotPower, int aDiameter, int aHeight, double x, double y, Appearance ap) {
		super(aDiameter, aHeight, x, y);
		this.power = shotPower;
		this.setAppearance(ap);
	}

	@Override
	public boolean isSolid() {
		return false;
	}

	@Override
	protected void onCollisionWithSolid(CollisionableComponent gc) {
		
	}

	@Override
	protected void defineCollide(CollisionableComponent gc) {
		gc.collideWithProyectile(this);
	}

	@Override
	protected void effectiveUpdate(DeltaState deltaState) {
		this.generciMove(deltaState, this.getSpeed(), this.getDirVecX(), this.getDirVecY());
	}

	public double getSpeed() {
		return speed;
	}

	public void setSpeed(double speed) {
		this.speed = speed;
	}

	public double getDirVecX() {
		return dirVecX;
	}

	public void setDirVecX(double dirVecX) {
		this.dirVecX = dirVecX;
	}

	public double getDirVecY() {
		return dirVecY;
	}

	public void setDirVecY(double dirVecY) {
		this.dirVecY = dirVecY;
	}

	public void impactOn(Asteroid asteroid) {
		this.destroyComponent();
	}

	public int getPower() {
		return this.power;
	}

}
